package com.algo.pattern.command.command;

import com.algo.pattern.command.constants.RequestConstant;
import com.algo.pattern.command.request.QueryOrderRequest;
import com.algo.pattern.command.response.QueryOrderResponse;
import com.algo.pattern.command.util.StringUtils;
import com.alibaba.fastjson.JSONObject;

/**
 * 查询美团订单命令接口
 */
public class QueryOrderRequestCommand extends AbstractMeituanRequestCommand<QueryOrderRequest, QueryOrderResponse> {

    /**
     * 美团订单查询
     * @param response
     * @return
     */
    @Override
    protected QueryOrderResponse handleResponse(String response) {
        if (StringUtils.isEmpty(response)){
            return new QueryOrderResponse();
        }
        return JSONObject.parseObject(response, QueryOrderResponse.class);
    }

    /**
     * 请求路径
     * @return
     */
    @Override
    protected String getMethodName() {
        return RequestConstant.ORDER_QUERY;
    }
}
